﻿// Copyright (c) 2014 Mike Fitzpatrick, CodeGenius.com

using System;
using System.Diagnostics;
using System.Windows.Forms;
using CodeGenius;

namespace CICheckMenuExample {
	public partial class CICheckMenuExample : Form {
		public CICheckMenuExample() {
			InitializeComponent();
		}

		private void CICheckMenuExample_Load(object sender, EventArgs e) {
			CICheckboxMenu.IItem chkbox = 
				ciCheckboxMenu1.Add("Check1Name"
					, new CICheckboxMenu.Checkbox("Check1", true));
			chkbox.Item.Click += Check1_Click;
			chkbox.Tooltip = "Check1Tooltip";
			((ToolStripMenuItem)chkbox.Item).CheckedChanged += Check1_CheckChanged;
			
			CICheckboxMenu.IItem txtbox =
				ciCheckboxMenu1.Add("Text1Name"
					, new CICheckboxMenu.Textbox("Text1", "Text1label"));
			((CICheckboxMenu.Textbox)txtbox).Tooltip = "Text1Tooltip";
			txtbox.Item.Click += Text1_Click;
			txtbox.Item.TextChanged += Text1_TextChanged;

			ContextMenuStrip mnu = ciCheckboxMenu1.Add("Menu1Name"
				, new CICheckboxMenu.Label("SubMenu1")
				, (ContextMenuStrip)null);
			mnu.Items.Add("Mnu1");
			mnu.Items.Add("Mnu2");
			mnu.Items.Add("Mnu3");
			mnu.Items.Add("Mnu4");

			CICheckboxMenu chkMenu = ciCheckboxMenu1.Add("Menu1Name"
				, new CICheckboxMenu.Label("SubMenu2")
				, (CICheckboxMenu)null);
			CICheckboxMenu.IItem txtbox1 =
				chkMenu.Add("txt2Name", new CICheckboxMenu.Textbox("Test2", "Test2Val"));
			((CICheckboxMenu.Textbox)txtbox1).Tooltip = "Test2Tooltip";

		}
		void Check1_Click(object sender, EventArgs e) {
			Debug.WriteLine("Check1_Click");
		}
		void Check1_CheckChanged(object sender, EventArgs e) {
			Debug.WriteLine("Check1_CheckChanged");
		}

		void Text1_Click(object sender, EventArgs e) {
			Debug.WriteLine("Text1_Click");
		}
		void Text1_TextChanged(object sender, EventArgs e) {
			Debug.WriteLine("Text1_CheckChanged");
		}
	}
}
